<template>
  <div>
     <!-- 面包屑 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>订单管理</el-breadcrumb-item>
      <el-breadcrumb-item>订单列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图 -->
    <el-card class="box-card">
      <div id="main"></div>
    </el-card>
  </div>
</template>

<script>
import echarts from 'echarts'
export default {
  data () {
    return {

    }
  },

  created () {

  },
  mounted () {
    this.initEcharts()
  },
  methods: {
    async initEcharts () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'))
      // 绘制图表
      const { data: res } = await this.$axios.get('reports/type/1')
      // 添加鼠标经过效果
      res.data.tooltip = {
        trigger: 'axis',
        type: 'cross',
        label: {
          backgroundColor: '#6a7985'
        }
      }
      // 去除X轴两侧留白
      res.data.xAxis[0].boundaryGap = false
      myChart.setOption(res.data)
    }
  }
}
</script>

<style scoped lang='less'>
#main {
  width: 800px;
  height: 400px;
}
</style>
